import {qss} from '../util/request'
import request from '../util/request'

export const getCodeUrl = () => {
    let backUrl = process.env.VUE_APP_CLIENT + '/login'
    let url = process.env.VUE_APP_DOMAIN + '/api/wx/code?backUrl=' + backUrl
    return url
}

export const login = (code) => {
    let url = '/api/wx/web/login'
    let param = {
        code: code,
    }
    return request.post(url, qss(param))
}

export const testLogin = (userId) => {
    let url = '/api/wx/testLogin'
    let param = {
        userId: userId
    }
    return request.post(url, qss(param))
}
